<template>
	<view class="u-p-b-160">
		<view class="u-p-30">
			<view class="u-p-20 u-b-r-16 bg_FFFFFF">
				<view class="u-flex u-p-20" style="border-bottom: 1rpx solid #F4F1F1;">
					<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img1.png' width='36rpx' height='36rpx'></u-image>
					<view class="u-p-l-10 u-weight u-h-36">{{userinfo.shop_name}}</view>
				</view>
				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;"
					v-for="(item,index) in userinfo.item" :key="index">
					<view class="u-flex">
						<view class="">
							<u-image :src='item.imgs[0]' width='183rpx' height='183rpx'></u-image>
						</view>
						<view class="u-p-l-30 ">
							<view class="u-weight">{{item.goods_name}}</view>
							<view class="u-font-26 u-m-t-20">运费:{{userinfo.delivery_amount}}</view>
							<view class=" u-font-24 u-m-t-10">
								<view class="">{{item.spece_content}}</view>

							</view>
							<view class="u-flex u-row-between u-w-300">
								<view class=" u-p-t-10" style="color: #FC3533;">￥{{item.price}}</view>
								<view class="u-font-26" style="color:#454545;">{{item.num}}</view>
							</view>

						</view>

					</view>

				</view>

				<view class=" u-p-t-30 u-p-r-30" style="text-align: right;color: #68615F;">合计<text class="u-weight"
						style="color: #FC3533;">￥{{userinfo.pay_amount}}</text></view>
			</view>
		</view>

		<view class="u-p-30">
			<view class="u-p-20 bg_FFFFFF u-b-r-16">
				<view class="u-flex u-row-between u-p-b-50 u-p-t-30" style="border-bottom: 1rpx solid  #F4F1F1;">
					<view class="">选择发票抬头</view>
					<view class="" style="color:;" @click='show=true'>
						<text>{{text}}</text>
						<u-icon name='arrow-right'></u-icon>
					</view>
				</view>
				<view class="u-weight u-p-t-40">开票说明</view>
				<view class="u-flex u-m-t-30 cl_454545FF">
					<view style="width: 150rpx;">企业发票:</view>
					<view class="">企业删掉是的非的风格让</view>
				</view>
				<view class="u-flex u-m-t-10">
					<view style="width: 150rpx;"></view>
					<view class="">企业删掉是的非的风格让</view>
				</view>

				<view class="u-flex u-m-t-10">
					<view style="width: 150rpx;">开票期限:</view>
					<view class="">企业删掉是的非的风格让</view>
				</view>

				<view class="u-flex u-m-t-10">
					<view style="width: 150rpx;">收票期限:</view>
					<view class="">企业删掉是的非的风格让</view>
				</view>
				<view class="u-flex u-m-t-10">
					<view style="width: 150rpx;">注意事项:</view>
					<view class="">企业删掉是的非的风格让</view>
				</view>
			</view>
		</view>

		<view class="u-fix u-w-750 u-b-0 u-p-30 bg_FFFFFF">
			<view class="u-w-630 u-h-98 u-text-center u-l-h-98 u-font-30 u-b-r-16 cl_FFF u-auto"
				style="background: linear-gradient(-64deg, #FF382C, #FF633F);" @click="trues">提交</view>
		</view>

		<u-picker mode="selector" v-model="show" :default-selector="[0]" :range="array" range-key="name"
			@confirm='confirm'></u-picker>
		<u-picker mode="selector" v-model="shows" :default-selector="[0]" :range="array1" range-key="name"
			@confirm='confirm1'></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nums: 0,
				show: false,
				shows:false,
				// show1: false,
				userinfo: '',
				list: [],
				array: [{
						id: 1,
						name: '个人抬头'
					},
					
					{
						id: 2,
						name: '企业抬头'
					}
				],
				array1: [],
				order_id: '',
				text: '选择抬头'
			}
		},
		onLoad() {
			this.userinfo = uni.getStorageSync("open_massage")
			console.log(this.userinfo);
		},
		onShow() {
			this.get()
		},
		methods: {
			get() {
				this.$api.add_open_list({
					Page: 1,
					page_size: 50
				}, res => {
					console.log(res);

					this.list = res.data.data.data
					this.order_id = this.list[0].id
				})

			},
			// 选择个人还是企业
			confirm(e) {
				this.array1=[]
				let arr = this.array[e[0]].id
				for (var i = 0; i < this.list.length; i++) {
					if (arr == this.list[i].type) {
						this.array1.push(this.list[i])
					}
				}
				this.shows=true
			},
			// 选择抬头信息
			confirm1(e) {
				this.order_id=this.array1[e[0]].id
				this.text=this.array1[e[0]].name
			},
			// 点击提交按钮
			trues() {
				this.$api.lick_open_massage({
					order_id: this.userinfo.id,
					member_invoice_id: this.order_id
				}, res => {
					if (res.data.code == 1) {
						uni.showToast({
							icon: 'none',
							title: '申请成功'
						})
						setTimeout(() => {
							uni.navigateBack()
						}, 500)
					} else {
						uni.showToast({
							icon: 'none',
							title: res.data.msg
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
	page {
		background: #f5f5f5;
	}

	.bgc {
		background: #F4F4F4;
	}

	.bgc1 {
		background: #FFF2F2;
		border: 1rpx solid #FC3533;
	}
</style>
